package com.gopay.common.exception.mail;

import org.apache.commons.lang.StringUtils;

import com.gopay.common.exception.GopayException;

public class GopayMailException extends GopayException {

    /**
     * 
     */
    private static final long serialVersionUID = 5914175723459501021L;

    private String receiver;

    private String sender;

    public GopayMailException() {
        super();
    }

    public GopayMailException(String errCode) {
        super(errCode);
    }

    public GopayMailException(String receiver, String errCode) {
        super(errCode);
        this.receiver = receiver;
    }

    public GopayMailException(String sender, String receiver, String errCode) {
        super(errCode);
        this.receiver = receiver;
        this.sender = sender;
    }

    @Override
    public String printErrMsg() {
        StringBuffer msg = new StringBuffer();

        if (StringUtils.isNotBlank(errCode)) {
            msg.append("Exception errCode is [").append(this.errCode).append("];\n");
        }

        if (StringUtils.isNotBlank(receiver)) {
            msg.append("Exception receiver is [").append(this.receiver).append("];\n");
        }

        if (StringUtils.isNotBlank(sender)) {
            msg.append("Exception sender is [").append(this.sender).append("];\n");
        }

        return msg.toString();
    }
}
